package com.woniu.payback_font.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniu.payback_font.entity.Load;
import com.woniu.payback_font.entity.Repayment;
import com.woniu.payback_font.mapper.RepaymentMapper;
import com.woniu.payback_font.service.RepaymentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.List;

@Service
public class RepaymentServiceImpl implements RepaymentService {
    @Autowired
    RepaymentMapper repaymentMapper;

    @Override
    public BigDecimal queryIntestAll(String lReceiptNo) {
        return repaymentMapper.selectInstestAll(lReceiptNo);
    }

    /**
     * 查看分期详情代码
     * @param lReceiptNo
     * @return
     */
    @Override
    public PageInfo<Repayment> findLoadList(Integer pageNum, Integer pageSize, String lReceiptNo) {
        PageHelper.startPage(pageNum,pageSize);
        List<Repayment> list =repaymentMapper.findLoadList(lReceiptNo);
        return new PageInfo<>(list);
    }

    /**
     * 查看所有
     * @return
     */
    @Override
    public PageInfo<Repayment> findAll(Integer pageNum, Integer pageSize) {
        List<Repayment> list = repaymentMapper.findAll();
        return new PageInfo<>(list);
    }

    /**
     * 查看单人
     * @param pageNum
     * @param pageSize
     * @param aUid
     * @return
     */
    @Override
    public PageInfo<Repayment> findOne(Integer pageNum, Integer pageSize, String aUid) {
        List<Repayment> list = repaymentMapper.findOne(aUid);
        return new PageInfo<>(list);
    }


}
